import http from '@/utils/http'

export const getRoleList = (data) => {
  return async (dispatch) => {
    console.log(data)
    const res = await http.get('/sys/role', { params: data })
    console.log(res)
    dispatch({
      type: 'roleManagement/getRoleList',
      payload: {
        ...res.data.data,
        ...data,
      },
    })
  }
}

export const delRole = (id) => {
  return async () => {
    await http.delete(`/sys/role/${id}`)
  }
}
